﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;

namespace DotNet.NH
{
    public class SessionManager
    {
        public static ISession GetSession()
        {
            //var session = HttpContext.Current.Items["NHibernateSession"];
            //if (session == null) {
            //    session = ...; // Create session, like SessionFactory.createSession()...
            //    HttpContext.Current.Items.Add("NHibernateSession", session);
            //}
            //return session;
            throw new NotImplementedException();
        }

        public static void CloseSession()
        {
            //var session = HttpContext.Current.Items["NHibernateSession"];
            //if (session != null)
            //{
            //    if (session.IsOpen)
            //    {
            //        session.close();
            //    }
            //    HttpContext.Current.Items.Remove("NHibernateSession");
            //}
            throw new NotImplementedException();
        }

        //protected void Application_EndRequest(object sender, EventArgs args)
        //{
        //    NHibernateSessionManager.CloseSession();
        //}
    }
}
